<%-- 
    Document   : MDoctorDetail
    Created on : 26 ?.?. 2554, 15:41:48
    Author     : SUNTIPARB
--%>

<script type="text/javascript">
     // pre-submit callback
    function showRequest(formData, jqForm, options) {
//        // formData is an array; here we use $.param to convert it to a string to display it
//        // but the form plugin does this for you automatically when it submits the data
//        var queryString = $.param(formData);
//
//        // jqForm is a jQuery object encapsulating the form element.  To access the
//        // DOM element for the form do this:
//        // var formElement = jqForm[0];
//
//        alert('About to submit: \n\n' + queryString);
//
//        // here we could return false to prevent the form from being submitted;
//        // returning anything other than false will allow the form submit to continue
//        return true;
    }

    // post-submit callback
    function showResponse(responseText, statusText, xhr, $form)  {
        ContentAjaxRequest('SRV/MDoctorList', 'section #container');
    }
    $(document).ready(function() {
        $("#formMDoctor input, #formMDoctor select,#formMDoctor button").uniform();
        $("#btnBack").click(function(){
            ContentAjaxRequest('SRV/MDoctorList', 'section #container');
        });

        //Bind form submit
        var options = {
            url: '<%=request.getContextPath()%>/SRV/MDoctorDetail/formMDoctor_Submit',
            type: 'POST',
            dataType:  'json',
            beforeSubmit:  showRequest,  // pre-submit callback
            success:       showResponse  // post-submit callback

            // other available options:
            //url:       url         // override for form's 'action' attribute
            //type:      type        // 'get' or 'post', override for form's 'method' attribute
            //dataType:  null        // 'xml', 'script', or 'json' (expected server response type)
            //clearForm: true        // clear all form fields after successful submit
            //resetForm: true        // reset the form after successful submit

            // $.ajax options can be used here too, for example:
            //timeout:   3000
        };
        $("#formMDoctor").validate({
            rules: {
                txtName : "required",
                txtSurname : "required"
//                txtCode : "required"
            },
            messages: {
                txtName : "Please enter Doctor Name",
                txtSurname : "Please enter Doctor Surname"
//                txtCode : "Please enter Doctor Code"
            },
            submitHandler: function(form) {
                $(form).ajaxSubmit(options);
            }
        });

    });


</script>
<%-- End Form Function --%>
<!-- insert content here -->
<h3>Doctor Detail</h3>
<div class="grid_8">
    <div class="box1">
        <div class="indent-box1">
            <div class="wrapper">
                <form id="formMDoctor" class="form" method="GET">
                <!-- Query String -->
                    <input type="hidden" id="DoctorId" name="DoctorId" value="<%=  request.getAttribute("DoctorId")%>" />
                <!-- End Query String -->
                    <table>
                        <tr>
                            <td><em>Name</em></td>
                        </tr>
                        <tr>
                            <td>
                                <div class="p1" id="txtName_wrapper">
                                    <input type="text" name="txtName" id="txtName" class="width-100" value="<%=  request.getAttribute("txtName")%>" />
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td><em>Surname</em></td>
                        </tr>
                        <tr>
                            <td>
                                <div class="p1" id="txtSurname_wrapper">
                                    <input type="text" name="txtSurname" id="txtSurname" class="width-100" value="<%=  request.getAttribute("txtSurname")%>" />
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td><em>Sex</em></td>
                        </tr>
                        <tr>
                            <td>
                                <div class="p1" id="rdbSex_wrapper">
                                <input type="radio" name="rdbSex" id="rdbSex_Male" class="" value="Male" <%=  request.getAttribute("rdbSex_Male")%> />Male
                                <input type="radio" name="rdbSex" id="rdbSex_Female" class="" value="Female" <%=  request.getAttribute("rdbSex_Female")%> />Female
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td><em>Code</em></td>
                        </tr>
                        <tr>
                            <td>
                                <div class="p1" id="txtCode_wrapper">
                                    <input type="text" name="txtCode" id="txtCode" class="width-100" value="<%=  request.getAttribute("txtCode")%>" />
                                </div>
                            </td>
                        </tr>
                        <tr>
                            <td class="control">
                                <input type="submit" name="btnSubmit" id="btnSubmit" value="Submit" />
                                <input type="button" name="btnBack" id="btnBack" value="Back" />
                            </td>
                        </tr>
                    </table>
                </form>
            </div>
        </div>
    </div>
</div>
